<?php

namespace app\api\controller;

use app\api\model\Exhibition as mExhibition;
use app\common\controller\Api;

/**
 * 展厅接口
 */
class Exhibition extends Api
{
    protected $noNeedLogin = ['*'];

    /**
     * 展厅列表
     * @return void
     * @throws \think\exception\DbException
     */
    public function list()
    {
        $where['pid']=0;
        $list=(new mExhibition())->order('weigh desc')->where($where)->paginate(10);
        $this->success('',$list);
    }

    /**
     * 展厅详情
     * @return void
     * @throws \think\exception\DbException
     */
    public function details(){
        $id = request()->param('id');
        $data['find']=(new mExhibition())->get($id);
        if($data['find']['status']==1){
            $where_exhibit['pid']=$data['find']['id'];
            $data['find']['exhibit']=(new mExhibition())->where($where_exhibit)->select();
        }
        $this->success('',$data);
    }



}